package com.domcer.ultra.menu.application.loader;

import acl.ILoader;
import com.domcer.ultra.menu.BootStrap;
import com.domcer.ultra.menu.application.listener.InventoryClickListener;
import com.domcer.ultra.menu.application.listener.InventoryCloseListener;
import com.domcer.ultra.menu.application.listener.PlayerInteractListener;
import org.bukkit.event.Listener;

import java.util.Arrays;

/**
 * @Author hang.wang
 * @Date 2025/1/31 11:22
 */
public class ListenerLoader implements ILoader {

    @Override
    public void execute0() {
        Arrays.asList(
                new PlayerInteractListener(),
                new InventoryClickListener(),
                new InventoryCloseListener()
        ).forEach(this::registerListener);
    }

    private void registerListener(Listener listener) {
        BootStrap.PLUGIN.getServer().getPluginManager().registerEvents(listener, BootStrap.PLUGIN);
    }
}
